﻿using System; 
using System.Drawing;
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data.SqlClient;
using System.Data; 
using CrystalDecisions.Shared; 
using CrystalDecisions.CrystalReports.Engine; 
using PointOfSale.Global;

namespace PointOfSale.Report.BaoCaoBanHangTheoNgay
{
	/// <summary>
	/// Summary description for frmReportBCBH.
	/// </summary>
	public class frmReportBCBH : System.Windows.Forms.Form
	{
		public DateTime FromDate;
		public DateTime ToDate;
		public string strDepartment;

		//float AmtTol, PaidAmtTol, TaxTol;
		//float DisTol,DisAmtTol, PostAmtTol,BalanceTol;
																				


	//	public DataTable dsBCBanhang = new DataTable("BCBanhang");
		ReportDocument crReportDocument = new ReportDocument();
		private CrystalDecisions.Windows.Forms.CrystalReportViewer crvPOSList;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmReportBCBH()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.crvPOSList = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
			this.SuspendLayout();
			// 
			// crvPOSList
			// 
			this.crvPOSList.ActiveViewIndex = -1;
			this.crvPOSList.DisplayBackgroundEdge = false;
			this.crvPOSList.DisplayGroupTree = false;
			this.crvPOSList.Dock = System.Windows.Forms.DockStyle.Fill;
			this.crvPOSList.Location = new System.Drawing.Point(0, 0);
			this.crvPOSList.Name = "crvPOSList";
			this.crvPOSList.ReportSource = null;
			this.crvPOSList.ShowExportButton = false;
			this.crvPOSList.ShowGotoPageButton = false;
			this.crvPOSList.ShowGroupTreeButton = false;
			this.crvPOSList.ShowPageNavigateButtons = false;
			this.crvPOSList.Size = new System.Drawing.Size(832, 430);
			this.crvPOSList.TabIndex = 0;
			this.crvPOSList.Load += new System.EventHandler(this.crvPOSList_Load);
			// 
			// frmReportPOSList
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(832, 430);
			this.Controls.Add(this.crvPOSList);
			this.Name = "frmReportBCBH";
			this.Text = "frmReportBCBH";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Load += new System.EventHandler(this.frmReportBCBH_Load);
			this.ResumeLayout(false);

		}
		#endregion

		
		private DataColumn CreateNewColumn( string sColumnType, string sColumnCaption,string sColumnName)
		{
			DataColumn dtColumn = new DataColumn();			
			dtColumn.DataType = System.Type.GetType("System." + sColumnType);
			dtColumn.ColumnName = sColumnName;
			dtColumn.Caption = sColumnCaption;			
			dtColumn.AutoIncrement = false;			
			dtColumn.ReadOnly = false;
			dtColumn.Unique = false;
			return dtColumn;
		}

		private void crvPOSList_Load(object sender, System.EventArgs e)
		{
			
			rptbcBH rpt = new rptbcBH();
			dsBCBanhang ds  = new dsBCBanhang();
			SqlCommand cmd = new SqlCommand("BCBanhang", clsGlobal.g_DataConn);
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.Parameters.Add("@FromDate", SqlDbType.DateTime);
			cmd.Parameters["@FromDate"].Value = FromDate;
			cmd.Parameters.Add("@ToDate", SqlDbType.DateTime);
			cmd.Parameters["@ToDate"].Value = ToDate;
			SqlDataAdapter sda = new SqlDataAdapter(cmd);
			sda.Fill(ds, "BCBanhang");	
			rpt.SetParameterValue("@FromDate",FromDate);
			rpt.SetParameterValue("@ToDate",ToDate);
			rpt.SetDataSource(ds);
			this.crvPOSList.ReportSource = rpt;
	
		}

		private void frmReportBCBH_Load(object sender, System.EventArgs e)
		{
		
		}
	}
}
